package com.bems.service;

import java.util.List;
import java.util.Map;

import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.enums.EnumUtils;

import com.bems.common.UtilEnum;
import com.bems.dao.SupplyDao;
import com.bems.pojo.Supply;
import com.bems.util.PageUtil;

public class SupplyService 
{
			SupplyDao supplyDao = new SupplyDao();
			
			public PageUtil list(int page ,int size)
			{
				PageUtil pageUtil = new PageUtil();
				pageUtil.setTotalpage(new Supply().totalCount());
				pageUtil.setPage(page);
				pageUtil.setSize(size);
				pageUtil.setList(new Supply().list(page, size));
				return pageUtil;
			}
			
			public boolean add(Supply supply)
			{
				
					return supplyDao.save(supply);
				
			}
			
			public boolean update(Supply supply)
			{
				return false;
				
			}
			
			public List<Supply> list() {
				Map<String, Object> map = new HashedMap();
				map.put("status", UtilEnum.Supply_Stauts.IsUse.getValue());
				return (List<Supply>) new Supply().getlist(map );
				
			}
}
